#!/usr/bin/env python
# -*- coding: UTF-8 -*-
# @Project : chat_model 
# @File    : dialogue_model.py
# @IDE     : PyCharm 
# @Author  :ZH
# @Time    : 2025/1/3 18:10
from tortoise import fields

from apps.models.base_model import BaseModel
from apps.utils.enumerate import ModelTypeEnum


class Dialogue(BaseModel):
    __doc__ = "聊天记录信息表"
    session_id = fields.IntField(description='会话id', null=False, index=True)
    user_id = fields.IntField(description='用户id', null=False, index=True)
    query = fields.TextField(description='问题', null=False)
    answer = fields.TextField(description='回答', null=True)
    model_id = fields.IntField(description='模型id', null=False)
    model_name = fields.CharField(max_length=256, null=False, description='模型名称')
    tool = fields.JSONField(description='工具', null=True, default=[])
    usage_tokens = fields.IntField(description='使用token', null=True)

    class Meta:
        table = "dialogue"
        table_description = "聊天记录信息表"
